<?php
/* @var $this PageController */
/* @var $model Page */
/* @var $form CActiveForm */
?>

<div class="form">

    <?php $form=$this->beginWidget('CActiveForm', array(
          'id'=>'page-form',
          'enableAjaxValidation'=>false,
          //'htmlOptions'=> array('onsubmit'=> "jQuery('#Page_content').text(tinyMCE.getInstanceById('Page_content').getContent()); return true;")
)); ?>


    <div class="row">
        <?php echo $form->labelEx($model,'title'); ?>
        <?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>255, 'class'=>'span7')); ?>
        <?php echo $form->error($model,'title'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'description'); ?>
        <?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50, 'class'=>'span7')); ?>
        <?php echo $form->error($model,'description'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'rank'); ?>
        <?php echo $form->textField($model,'rank',array('size'=>60,'maxlength'=>255, 'class'=>'span7')); ?>
        <?php echo $form->error($model,'rank'); ?>
    </div>

    <div class="row">


        <div class="row">
            <?php echo $form->labelEx($model,'controller'); ?>

            <div class="input-prepend">
              <span class="add-on"><i class="icon-play"></i></span>
              <?php echo $form->textField($model,'controller',array('size'=>60,'maxlength'=>255, 'class'=>'span7')); ?>
             </div>

            <?php echo $form->error($model,'controller'); ?>

        </div>

        <div class="row">
            <?php echo $form->labelEx($model,'active'); ?>
            <?php echo $form->dropDownList($model, 'active', array(
                  1 => 'igen',
                  0 => 'nem'
		        ), array('class'=>'span7')); ?>
            <?php echo $form->error($model,'active'); ?>
        </div>

        <div class="row">
            <?php echo $form->labelEx($model,'parent_id'); ?>
            <?php echo $form->dropDownList($model,'parent_id', CHtml::listData($availableParents, 'id', 'title'), array('class'=>'span7')); ?>
            <?php echo $form->error($model,'parent_id'); ?>
        </div>

        <?php echo $form->labelEx($model,'content'); ?>

        <?php echo $form->textArea($model, 'content', array('class'=>'span7', 'style'=>'height: 400px;'));?>
        <?php echo $form->error($model,'content'); ?>

        <?php

        Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/scripts/redactor.js');
        Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/redactor.css');

        ?>
        <script type="text/javascript">
        $(function(){

        	   $('#Page_content').redactor();

        });
        </script>

    </div>

    <?php if(!$model->isNewRecord && null != $model->galleryBehavior->getGallery()){

       echo CHtml::openTag('fieldset');


       $this->widget('GalleryManager', array(
          'gallery' => $model->galleryBehavior->getGallery(),
          'controllerRoute' => 'gallery', //route to gallery controller
         ));

      echo CHtml::closeTag('fieldset');


    } ?>

    <div class="row buttons form-actions">
        <?php echo CHtml::submitButton('Mentés', array('class'=>'btn btn-info'));?>
        <?php echo CHtml::link('Mégse', array('admin')); ?>
    </div>

    <?php $this->endWidget(); ?>

</div>
<!-- form -->
